/**
 * Created with Intellij JDEA
 * Description:
 * User:
 * Date:2022-05-13
 * Time:13:36
 */
public class 替换空格 {
    public String replaceSpace(String s) {
        StringBuffer sb = new StringBuffer();
        for(int i = 0;i < s.length();i++) {
            char ch = s.charAt(i);
            if(ch == ' ') {
                sb.append("%20");
            }else {
                sb.append(ch);
            }
        }
        return sb.toString();
    }
}
